<?php

/**
 * 签到控制器
 */
class SignController extends YzwController {

    //用户签到
    public function actionSign() {
        $uid = Yii::app()->user->id;
        if (empty($uid)) {
            $this->error('请先登陆后,再签到！');
        }
        $model = new MembersSignModel();
        if ($model->signIn($uid, 0) == false) {
            $this->error($model->getOneError() ? $model->getOneError() : '签到失败！');
        } elseif($model->isSignIn($uid, 0) == FALSE) {
            $this->success("恭喜你成功获得  <font color=#dd004e>5</font>  个积分<div class= 'qd_success_content '>您还可以前往手机端签到再获&nbsp<font color=#dd004e>10</font> 个积分</div>");
        }else{
             $this->success("恭喜你成功获得  <font color=#dd004e>5</font>  个积分<div class= 'qd_success_content '>积分可参加免费兑换商品活动，详情请关注积分商城</div>");
        }
    }

    public function actionCalendar() {
        header('Content-type: text/html; charset=utf8');
        $uid = (int) Yii::app()->user->id;
        $model = new MembersSignModel();
        echo $model->getCalendarHtml($uid);
    }

}
